/**
 * v-copy
 * 复制某个值至剪贴板
 * 接收参数：string类型/Ref<string>类型/Reactive<string>类型
 */
let copyData = ''
const copy = {
	bind(el, binding) {
		copyData = binding.value;
		el.addEventListener("click", handleClick);
	},
	componentUpdated(el, binding) {
		copyData = binding.value;
	},
	unbind(el) {
		el.removeEventListener("click", el.handleClick);
	}
};
function handleClick() {
	uni.setClipboardData({
		data: copyData,
		success: () => {
			uni.showToast({
				title: '复制成功',
				mask: true
			})
		}
	})
}
export default copy;
